home *** CD-ROM | disk | FTP | other *** search
-
-
- #ifndef __WINDOWOBJ__
- #define __WINDOWOBJ__
-
- #include <Types.h>
- #include <Events.h>
-
- typedef struct WindowObj WindowObj, *WindowObjPtr, **WindowObjHndl;
-
- typedef void (*DrawContentProcPtr)(WindowObjHndl obj, short depth);
- typedef void (*NotifyProcPtr)(WindowObjHndl obj, long message);
- typedef void (*ActivateProcPtr)(WindowObjHndl obj, Boolean activate);
- typedef void (*ClickProcPtr)(WindowObjHndl obj, EventRecord *event, long message);
- typedef void (*KeystrokeProcPtr)(WindowObjHndl obj, long message, short modifiers);
-
- struct WindowObj {
- WindowPtr window;
- OSType type;
- DrawContentProcPtr draw;
- NotifyProcPtr notify;
- KeystrokeProcPtr keys;
- ActivateProcPtr activate;
- ClickProcPtr click;
- Boolean hasIdleTask;
- unsigned long refCon;
- };
-
-
- WindowObjHndl NewObjWindow(short windID, OSType type, Boolean itFloats,
- Boolean hasIdleTask, DrawContentProcPtr draw, KeystrokeProcPtr keys,
- ClickProcPtr click, ActivateProcPtr activate,
- NotifyProcPtr notify);
- void DisposeObjWindow(WindowObjHndl obj);
-
-
- //
- // Menus (duh)
- //
- enum {
- kAppleMenu = 128,
- kAboutItem = 1,
-
- kFileMenu = 129,
- kNewItem = 1,
- kOpenItem = 3,
- kCloseItem = 4,
- kQuitItem = 6,
-
- kEditMenu = 130,
- kUndoItem = 1,
- kCutItem = 3,
- kCopyItem = 4,
- kPasteItem = 5,
- kClearItem = 6,
- kSelectAllItem = 8
- };
-
- //
- // Window notification messages
- //
- enum {
- kCreateNotification = 1,
- kIdleNotification,
- kCloseNotification,
- kDestroyNotification,
- kAdjustMenusNotification,
- kGrowWindowNotification,
-
- kUndoNotification,
- kCutNotification,
- kCopyNotification,
- kPasteNotification,
- kClearNotification,
- kSelectAllNotification
- };
-
- //
- // Misc
- //
- enum {
- kAppWindowKind = 99
- };
-
- #if !defined(check)
- #define check(some_expr) do {if (!(some_expr)) DebugStr("\pcheck failed");} while (0);
- #endif
-
- #if !defined(require)
- #define require(some_expr, some_label) do { if (!(some_expr)) \
- {DebugStr("\prequire failed"); goto some_label;}} while (0);
- #endif
-
- void pstrcpy(void *src, void *dest);
- void pstrcat(Str255 frontStr, ConstStr255Param backStr);
-
- void DisableAllMenuItems(MenuHandle menu);
- void EnableAllMenuItems(MenuHandle menu);
- Boolean IsAppWindow(WindowPtr win);
- GrafPtr SetupPort(GrafPtr port);
-
-
- #endif
-